<!DOCTYPE HTML>
<html>
<?php
include 'for_test_all.php';

$path = 'test.json';
// 从文件中读取数据到PHP变量  
$json_string = file_get_contents($path);

// 用参数true把JSON字符串强制转成PHP数组  
$data = json_decode($json_string, true);
// 显示出来看看  
// var_dump($json_string); 
// var_dump ($data);
// var_dump(count($data)); 
// print_r($data); 
//读取时间戳 对应转换
//strtotime('2014-11-17') * 1000;

//processJson($data,$path);

function processJson($data, $path)
{
    $res = [];
    $temp = [];
    // 收益数据  json
    //最开始设置初试资金
    $temp[0] = strtotime($data[0]['start_day']) * 1000;
    $temp[1] = 1000000;
    array_push($res, $temp);
    for ($m = 0; $m < count($data); $m++) {

        $temp[0] = strtotime($data[$m]['end_day']) * 1000;
        $temp[1] = round($res[$m][1] * (1 + $data[$m]['real_shouyilv'] / 100), 2);
        array_push($res, $temp);
    }
    $res_json = json_encode($res);
    file_put_contents('json/' . $path, $res_json);
}

?>

<head>
    <meta charset="utf-8">
    <link rel="icon" href="https://jscdn.com.cn/highcharts/images/favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        .highcharts-axis-resizer {
            stroke: #eee;
        }

        .highcharts-axis-resizer:hover {
            stroke: #ccc;
        }
    </style>
    <script src="https://code.highcharts.com.cn/jquery/jquery-1.8.3.min.js"></script>
    <script src="https://code.highcharts.com.cn/highstock/highstock.js"></script>
    <script src="https://unpkg.com/highcharts/modules/exporting.js"></script>
    <script src="https://code.highcharts.com.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
</head>
<script>
    $.getJSON('json/Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '股票排序折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>
<script>
    $.getJSON('json/bkdm_Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container1', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '板块代码排序折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy1_5_Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container2', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前五天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy1_10_Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container3', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前10天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy1_20_Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container4', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前20天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>
<script>
    $.getJSON('json/polocy1_60_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container1_60', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前60天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>
<script>
    $.getJSON('json/polocy1_30_Profit.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container5', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前30天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy2_5_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container6', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前五天积分排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy2_10_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container7', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前10天积分排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy2_20_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container8', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前20天积分排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>


<script>
    $.getJSON('json/polocy2_60_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container2_60', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前60天积分排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/polocy2_30_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container9', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '前30天积分排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/6_mouth_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container-10', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '6个月训练-前30天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/7_mouth_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container-11', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '7个月训练-前30天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/8_mouth_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container-12', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '8个月训练-前30天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<script>
    $.getJSON('json/9_mouth_test.json', function(data) {

        // 去掉多余的数据
        Highcharts.each(data, function(d) {
            d.length = 2;
        });
        Highcharts.stockChart('container-13', {
            rangeSelector: {
                selected: 5
            },
            title: {
                text: '9个月训练-前30天每日排名折线图'
            },
            plotOptions: {
                series: {
                    showInLegend: true
                }
            },
            tooltip: {
                split: false,
                shared: true
            },
            series: [{
                // type: 'line',

                name: '收益曲线',
                data: data
            }]
        });
    });
</script>

<body>

    <div class="panel panel-default mt-20">
        <div id="container" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container1" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container2" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container3" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container4" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container5" style="min-width:400px;height:400px"></div>
    </div>
    

    <div class="panel panel-default mt-20">
        <div id="container1_60" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container6" style="min-width:400px;height:400px"></div>
    </div>

    <div class="panel panel-default mt-20">
        <div id="container7" style="min-width:400px;height:400px"></div>
    </div>

    <div class="panel panel-default mt-20">
        <div id="container8" style="min-width:400px;height:400px"></div>
    </div>

    <div class="panel panel-default mt-20">
        <div id="container9" style="min-width:400px;height:400px"></div>
    </div>  
    <div class="panel panel-default mt-20">
        <div id="container2_60" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container-10" style="min-width:400px;height:400px"></div>
    </div>
    <div class="panel panel-default mt-20">
        <div id="container-11" style="min-width:400px;height:400px"></div>
    </div>

    <div class="panel panel-default mt-20">
        <div id="container-12" style="min-width:400px;height:400px"></div>
    </div>

    <div class="panel panel-default mt-20">
        <div id="container-13" style="min-width:400px;height:400px"></div>
    </div>
    
</body>

</html>